package Game;

public class AbstractSkill extends Card {
	// CONSTANTS
	
	// ATTRIBUTES
	/**
	 * Skill's level. Ranges from 1 to 3.
	 */
	int level = 1;
	/**
	 * Skill's AP cost.
	 */
	int APCost;
	
	/**
	 * True if Skill is magical. 
	 */
	boolean magical;
	/**
	 * Type of Skill's target.
	 */
	int targetType = Card.TARGET_ENEMY;
	
	// METHODS
	
	public AbstractSkill(String _ID) {
		super(_ID);
		setAPCost();
	}
	
	/**
	 * Sets this Skill's AP cost based on its ID and level.
	 */
	private void setAPCost() {
		switch (ID) {
		
		}
	}
	
	/**
	 * Called when a Unit obtains this Skill.
	 * @param unit Unit which obtains this Skill.
	 */
	public void onObtain(Unit unit) {
		unit.skills.add(this);
	}
	
	/**
	 * Called when a Unit loses this Skill.
	 * @param unit Unit which loses this Skill.
	 */
	public void onDismiss(Unit unit) {
		unit.skills.remove(this);
	}
	
	/**
	 * Called when a Unit uses this Skill.
	 * @param user Unit which uses this Skill.
	 */
	public void onUse(Unit user) {
		user.incAP(-APCost);
	}
	
	/**
	 * Called when this Skill levels up.
	 * @param unit Unit which has this skill.
	 */
	public void onSkillLevelUp(Unit unit) {
		onDismiss(unit);
		
		level++;
		setAPCost();
		
		onObtain(unit);
	}
}
